import request from '@/utils/request'
import { BasePageReq, BaseResponse } from '../base'

export function getJobList(params: BasePageReq): Promise<BaseResponse> {
  return request({ url: '/campus/partTimeJob/pageQuery', method: 'get', params })
}

export function getJobDetail(id: number): Promise<BaseResponse> {
  return request({ url: `/campus/partTimeJob/queryById/${id}`, method: 'get' })
}

export function apply(id: number): Promise<BaseResponse> {
  return request({ url: `/campus/partTimeJob/apply/${id}`, method: 'post' })
}

export function myApply(params: BasePageReq): Promise<BaseResponse> {
  return request({ url: '/campus/partTimeJob/myApply', method: 'get', params })
}

export function cancelApply(id: number): Promise<BaseResponse> {
  return request({ url: `/campus/partTimeJob/cancelApply/${id}`, method: 'delete' })
}